import { Product } from "@prisma/client"

interface InventoryReportProps {
  products: Product[]
}

export function InventoryReport({ products }: InventoryReportProps) {
  return (
    <div className="overflow-x-auto">
      <table className="min-w-full divide-y divide-gray-200">
        <thead className="bg-gray-50">
          <tr>
            <th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">商品名称</th>
            <th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">库存数量</th>
            <th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">价格</th>
            <th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">创建时间</th>
          </tr>
        </thead>
        <tbody className="bg-white divide-y divide-gray-200">
          {products.map((product) => (
            <tr key={product.id}>
              <td className="px-6 py-4 whitespace-nowrap text-gray-700">{product.name}</td>
              <td className="px-6 py-4 whitespace-nowrap text-gray-700">{product.stock}</td>
              <td className="px-6 py-4 whitespace-nowrap text-gray-700">¥{product.price.toFixed(2)}</td>
              <td className="px-6 py-4 whitespace-nowrap text-gray-700">{new Date(product.createdAt).toLocaleString()}</td>
            </tr>
          ))}
        </tbody>
      </table>
    </div>
  )
} 